
$(function () {
    // 登录请求
    $('.input_sub').on('click', function (e) {
        e.preventDefault()
        let username = $('.input_txt').val().trim();
        let password = $('.input_pass').val().trim();
        if (!username || !password) {
            $('#myModal').modal('show');
            return
        }
        $.ajax({
            type: 'post',
            url: BigNew.user_login,
            data: {
                username,
                password
            },
            success: function (backData) {
                if (backData.code == 200) {
                    $('.modal-body p').text(backData.msg);
                    $('#myModal').modal('show');
                    $('#myModal').on('hidden.bs.modal', function () {
                        window.localStorage.setItem('token', backData.token)
                        window.location.href = './index.html';
                    });
                } else if (backData.code == 400) {
                    $('.modal-body p').text(backData.msg);
                    $('#myModal').modal('show');
                };
            },
        });
    });

});